package com.dili.dd.gpi.mapper;

import com.dili.dd.gpi.domain.UidNameSpace;
import com.dili.dd.gpi.enums.PrefixType;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public interface ExtUidNameSpaceMapper {
    @Select({
            "select",
            "id, name_space, `type`,`level`, current_value, create_time, update_time",
            "from uid_name_space",
            "where BINARY name_space = #{nameSpace} and `type` = #{prefixType} and level=#{level}"
    })
    @ResultMap("BaseResultMap")
    List<UidNameSpace> getByPrefix(@Param("nameSpace") String nameSpace, @Param("prefixType") PrefixType prefixType,
                                   @Param("level") String level);

    List<UidNameSpace> findReservedNameSpace(Map<String,Object> params);
}